package com.mouse.magent.common.handler;


import com.mouse.magent.common.protocol.Command;
import com.mouse.magent.common.protocol.Header;
import com.mouse.magent.common.protocol.Message;
import io.netty.channel.ChannelHandlerContext;

public class ClientHandler extends BaseHandler {
    private Command connectCommand;

    public ClientHandler(Command connectCommand) {
        this.connectCommand = connectCommand;
    }

    @Override
    public void channelActive(ChannelHandlerContext ctx) throws Exception {
        Message message = new Message();
        message.setType(connectCommand);
        Header header = new Header();
        message.setHeader(header);
        ctx.writeAndFlush(message);
        super.channelActive(ctx);
    }
}
